package com.dkakunsi.monev.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.dkakunsi.monev.entity.Program;
import com.dkakunsi.monev.util.MonevDataException;

@Repository("ProgramHibernateRepository")
public class ProgramDao extends GenericDao<Program> {
	@SuppressWarnings("unchecked")
	public List<Program> getByName(String name) throws MonevDataException {
		Query query = getSession().createQuery("SELECT p FROM Program p WHERE p.nama LIKE :nama");
		query.setParameter("nama", name);
		
		return checkNull(query.list());
	}
}
